package com.vcms.cms.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Type entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "type", catalog = "vcms_0.1")
public class Type implements java.io.Serializable {

	// Fields

	private Integer typeId;
	private String typeName;
	private Integer imgWidth;
	private Integer imgHeight;
	private Boolean hasImg;
	private Boolean isDisabled;
	private Set<Content> contents = new HashSet<Content>(0);

	// Constructors

	/** default constructor */
	public Type() {
	}

	/** full constructor */
	public Type(String typeName, Integer imgWidth, Integer imgHeight,
			Boolean hasImg, Boolean isDisabled, Set<Content> contents) {
		this.typeName = typeName;
		this.imgWidth = imgWidth;
		this.imgHeight = imgHeight;
		this.hasImg = hasImg;
		this.isDisabled = isDisabled;
		this.contents = contents;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "typeId", unique = true, nullable = false)
	public Integer getTypeId() {
		return this.typeId;
	}

	public void setTypeId(Integer typeId) {
		this.typeId = typeId;
	}

	@Column(name = "typeName", length = 100)
	public String getTypeName() {
		return this.typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	@Column(name = "imgWidth")
	public Integer getImgWidth() {
		return this.imgWidth;
	}

	public void setImgWidth(Integer imgWidth) {
		this.imgWidth = imgWidth;
	}

	@Column(name = "imgHeight")
	public Integer getImgHeight() {
		return this.imgHeight;
	}

	public void setImgHeight(Integer imgHeight) {
		this.imgHeight = imgHeight;
	}

	@Column(name = "hasImg")
	public Boolean getHasImg() {
		return this.hasImg;
	}

	public void setHasImg(Boolean hasImg) {
		this.hasImg = hasImg;
	}

	@Column(name = "isDisabled")
	public Boolean getIsDisabled() {
		return this.isDisabled;
	}

	public void setIsDisabled(Boolean isDisabled) {
		this.isDisabled = isDisabled;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "content_type", catalog = "vcms_0.1", joinColumns = { @JoinColumn(name = "typeId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "contentId", nullable = false, updatable = false) })
	public Set<Content> getContents() {
		return this.contents;
	}

	public void setContents(Set<Content> contents) {
		this.contents = contents;
	}

}